{% extends "base.html" %}

{% block title %}编辑用户{% endblock %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="mb-0">编辑用户信息</h4>
                </div>
                <div class="card-body">
                    <form method="post">
                        <div class="mb-3">
                            <label class="form-label">用户名</label>
                            <input type="text" class="form-control" value="{{ user.username }}" disabled>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">电子邮箱</label>
                            <input type="email" class="form-control" value="{{ user.email }}" disabled>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">姓名</label>
                            <input type="text" class="form-control" value="{{ user.full_name }}" disabled>
                        </div>
                        <div class="mb-3">
                            <label for="role" class="form-label">用户角色</label>
                            <select class="form-select" id="role" name="role" required>
                                <option value="engineer" {% if user.role == 'engineer' %}selected{% endif %}>测控工程师</option>
                                <option value="manager" {% if user.role == 'manager' %}selected{% endif %}>项目管理人员</option>
                                <option value="integrator" {% if user.role == 'integrator' %}selected{% endif %}>系统集成商</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label for="department" class="form-label">所属部门</label>
                            <input type="text" class="form-control" id="department" name="department" value="{{ user.department }}" required>
                        </div>
                        <div class="mb-3">
                            <label for="phone" class="form-label">联系电话</label>
                            <input type="tel" class="form-control" id="phone" name="phone" value="{{ user.phone }}" required>
                        </div>
                        <div class="text-end">
                            <a href="{{ url_for('main.user_detail', user_id=user.id) }}" class="btn btn-secondary">取消</a>
                            <button type="submit" class="btn btn-primary">保存更改</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 